package com.chelsea;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

public class TagPanel extends JPanel{

	ArrayList<Tag> tagList;
	Screen screen;
	
	public TagPanel(Screen s){
		super();
		tagList = new ArrayList<Tag>();
		this.setPreferredSize(new Dimension(400, 120));
		this.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		this.repaint();
		this.screen = s;
	}
	
	public void paint(Graphics g){
		super.paint(g);
		//super.paintComponent(g);
	}
	public void addTag(String name, int x, int y){
		
		Tag tag = new Tag(name, x, y, screen);
		tagList.add(tag);
		this.add(tag);
		
		this.validate();
	}

	public Tag findTags(int x, int y, int tagSize) {
		// TODO Auto-generated method stub
		for (Tag t: tagList){
			if(t.checkRange(x, y, tagSize))
				return t;
		}
		return null;
	}

}
